Foam is generally formed by trapping a great number of gaseous bubbles in a liquid and widely used in people's daily life, for example, in shaving, surface cleaning, etc.
Generally, bubbles are generated and then subject to a surface activation process which reduce surface tension of the liquid so as to prevent the bubbles from breaking.
One popular method of generating bubbles is called mechanical rabbling. Specifically, air and liquid are mixed by mechanical rabbling to generate bubbles. Other methods include gas pumping, heating, etc.
However, the above methods of generating bubbles in order to generate foams are usually for industrial applications and have their own disadvantages such as high cost, high complexity and low controllability.